<template>
  <div class="footer" @touchmove="touchMove">
    <!-- <div :class="{ nav: true, selectKey: pageKey === 1 }" @click="clickNav(1)">
      <span>
        <img
          v-if="pageKey === 1"
          class="navIcon"
          src="@/assets/images/mange_selected_icon.png"
          alt=""
        />
        <img
          v-else
          class="navIcon"
          src="@/assets/images/mange_icon.png"
          alt=""
        />
      </span>

      <span>电能计量信息</span>
    </div> -->
    <div :class="{ nav: true, selectKey: pageKey === 2 }" @click="clickNav(2)">
      <span>
        <img
          v-if="pageKey === 2"
          class="navIcon"
          src="@/assets/images/fenxi_selected_icon.png"
          alt=""
        />
        <img
          v-else
          class="navIcon"
          src="@/assets/images/fenxi_icon.png"
          alt=""
        />
      </span>
      <span>设备信息</span>
    </div>
    <div :class="{ nav: true, selectKey: pageKey === 3 }" @click="clickNav(3)">
      <span>
        <img
          v-if="pageKey === 3"
          class="navIcon"
          src="@/assets/images/my_selected_cion.png"
          alt=""
        />
        <img v-else class="navIcon" src="@/assets/images/my_cion.png" alt="" />
      </span>
      <span>我的</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { getSession } from "@/util/tools"
const pageKey = ref(2)
onMounted(() => {
  const page = getSession("pageKey")
  if (page) {
    pageKey.value = page
  }
})

const emit = defineEmits(["changePageKey"])

const clickNav = (key) => {
  pageKey.value = key
  emit("changePageKey", key)
}

const touchMove = (e) => {
  e.preventDefault()
}
</script>

<style scoped lang="less">
.footer {
  display: flex;
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 70px;
  // height: 60px;
  align-items: center;
  justify-content: space-around;
  background: #fff;
  color: #515151;

  .nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .selectKey {
    color: #03a9f4;
  }

  .navIcon {
    height: 24px;
  }
}
</style>
